//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package ccy.ccysolarcount.command;

import ccy.ccylibrary.plugin.annotation.command;
import ccy.ccylibrary.utils.Method;
import ccy.ccysolarcount.config.CcyConfig;
import java.util.UUID;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

@command(
        name = "csc"
)
public class PlayerCommand implements CommandExecutor {
    public PlayerCommand() {
    }

    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
        if (command.getName().equalsIgnoreCase("csc") && commandSender.hasPermission("csc.admin")) {
            if (commandSender instanceof Player && strings.length >= 1) {
                Player player = (Player)commandSender;
                UUID uniqueId = player.getUniqueId();
                if (strings[0].equals("tyn1")) {
                    if (CcyConfig.config.temp_tyn1.containsKey(uniqueId)) {
                        CcyConfig.config.temp_tyn1.put(uniqueId, CcyConfig.config.temp_tyn1.get(uniqueId) + 1);
                    } else {
                        CcyConfig.config.temp_tyn1.put(uniqueId, 1);
                    }

                    return true;
                }

                if (strings[0].equals("tyn2")) {
                    if (CcyConfig.config.temp_tyn2.containsKey(uniqueId)) {
                        CcyConfig.config.temp_tyn2.put(uniqueId, CcyConfig.config.temp_tyn2.get(uniqueId) + 1);
                    } else {
                        CcyConfig.config.temp_tyn2.put(uniqueId, 1);
                    }

                    return true;
                }
            }

            Method.sendmessage(commandSender, "/csc tyn1 - 太阳能1次数增加一次");
            Method.sendmessage(commandSender, "/csc tyn2 - 太阳能2次数增加一次");
        }

        return false;
    }
}
